package com.health.controller;

import com.health.config.FtpUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

@Api(tags = "上传文件相关接口")
@RestController
public class HelloConrtoller {

    @ApiOperation("上传文件")
    @PostMapping("hello")
    public Object hello(@ApiParam(value = "文件") @RequestPart("headImg") MultipartFile headImg) throws IOException {
        //调用FTP服务存储文件
        String fileName = FtpUtil.uploadFile(headImg);
        return "上传文件成功，文件名:" + fileName;
    }
}
